package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 行政区划
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_region`", autoResultMap = true)
public class LyRegion {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @NotNull
    @ApiModelProperty("行政区域父ID，例如区县的pid指向市，市的pid指向省，省的pid则是0")
    @TableField(value = "`pid`")
    private Integer pid;


    @Length(max = 120, message = "行政区域名称长度不能超过120位")
    @NotEmpty
    @ApiModelProperty("行政区域名称")
    @TableField(value = "`name`")
    private String name;


    @NotNull
    @ApiModelProperty("行政区域类型，如如1则是省， 如果是2则是市，如果是3则是区县")
    @TableField(value = "`type`")
    private Integer type;


    @NotNull
    @ApiModelProperty("行政区域编码")
    @TableField(value = "`code`")
    private Integer code;

}
